package com.ding.dao;

import com.ding.bean.Department;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * DepartmentMapper
 *
 * @author DYS
 * @date 2021/7/22
 * @time 19:29
 * @Description
 */
@Mapper
@Component
public interface DepartmentMapper {
	//查询所有的部门信息
	@Select("select * from department")
	List<Department> getAllDepartment();

	//根据id查询部门信息
	@Select("select * from department where id = #{id}")
	Department getDepartmentById(@Param("id") int id);

	//增加一个部门
	@Insert("insert into department(departmentName) values(#{departmentName})")
	int addDepartment(Department department);

	//根据id删除一个部门
	@Delete("delete from department where id = #{id}")
	int delDepartmentById(@Param("id") int id);

	//修改一个部门
	@Update("update department set departmentName = #{departmentName} where id = #{id}")
	int updDepartment(Department department);
}
